*****************
* J. HOOK, 5/27/2024
* STATA v. 18.0
* Updated 4/18/2025
* (1) Run jobs in LIS
* (2) Save .txt output
* (3) Paste into Excel using text import wizard, creating 8 files in "\excel_data" folder:
*		REG_results.xlxs
*		HECK_results
*		FT_results
*		WH_results
*		OCC_results
*		PUB_results
*		EXP_results
*		FT_OCC_results
* (4) Import each file into Stata using code below
*****************

*change path*
global MyProject "C:\Users\hook\Desktop\Projects\WagePaper\1_Current_Draft\Socius_R&R\Replication"
local ProjectDir "$MyProject"
cd "$MyProject"

*nested folders:
*\excel_data
*\data
*\graphs
*\tables

*put "$MyProject\data\Macro_and_Sample_Vars.dta" in "\data" folder
*put 8 excel files in "\excel_data" folder

*********************************************************************
*CREATE STATA FILES FROM EXCEL DATA*
*MERGE MACRO & SAMPLE VARS ONTO RESULTS BY DNAME FOR EACH EXCEL FILE*
*********************************************************************

/*
Note: macro vars in "$MyProject\data\Macro_and_Sample_Vars.dta" grand mean centered, except for year
*Grand mean macros: x - grand mean*
local varlist mospaid_lag1 mospaid_L9 mospaid_H9 mospaid_L6 mospaid_H6 mospaid_father_lag1 ecec1000 PubSec_lag1  wpt_lag1 gnorm_lag1
foreach var of local varlist  {
   egen m_`var' = mean(`var')
   gen  c_`var' = `var'-m_`var'
   drop m_`var'
   label variable c_`var' "Grand mean centered" 
   }
gen year2 = year-1999
*/

*use to import excel sheets into Stata
local varlist REG HECK FT WH OCC PUB EXP FT_OCC
foreach var of local varlist  {
	import excel "$MyProject\excel_data/`var'_results.xlsx", sheet("Sheet1") firstrow clear
	save "$MyProject\data/`var'.dta", replace
	merge 1:1 dname using "$MyProject\data\Macro_and_Sample_Vars.dta" 
	drop if _merge==2
	drop _merge
	order cname Country
	gen Sample_FT_OCC = Sample_FT
	recode Sample_FT_OCC (1=0) if Sample_OCC==0
	*gen weight variable - inverse SE*
	gen w_sex = 1/(dyse_sex)
	gen w_mother = 1/(dyse_mother)
	gen w_sex_HP = 1/(dyse_sex_HP)
	gen w_sex_LP = 1/(dyse_sex_LP)
	gen w_sex_HC = 1/(dyse_sex_HC)
	gen w_sex_LC = 1/(dyse_sex_LC)
	gen w_par_WH = 1/( dyse_par_WH)
	gen w_par_WL = 1/( dyse_par_WL)
	save "$MyProject\data/`var'.dta", replace
   }

   
*Compare gender and motherhood gaps before and after Heckman*
use "$MyProject\data\REG.dta", clear
keep dname dydx_sex dydx_mother
rename dydx_sex REG_sex
rename dydx_mother REG_mother
save "$MyProject\data\REG_for_merge.dta", replace 
use "$MyProject\data\HECK.dta", clear
merge 1:1 dname using  "$MyProject\data\REG_for_merge.dta"
drop _merge
gen diff_sex = REG_sex - dydx_sex
sum diff_sex
hist diff_sex
gen diff_mom = REG_mother - dydx_mother
sum diff_mom
hist diff_mom   

/*
. sum diff_sex

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
    diff_sex |        280   -1.797407     .942291    -4.9731      1.711

. sum diff_mom

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
    diff_mom |        280   -3.622153    1.953821   -11.5118     1.1611

*/

**********************************************
*Figure 1: Trends in Gender Earnings Gap and Motherhood Penalty by Country, Heckman adjusted
**********************************************

use "$MyProject\data\HECK.dta", clear
cd "$MyProject\graphs"

*create 95 CI from SE*
gen hi_sex = dydx_sex + 1.96*dyse_sex
gen lo_sex = dydx_sex - 1.96*dyse_sex
gen hi_mom = dydx_mother + 1.96*dyse_mother
gen lo_mom = dydx_mother - 1.96*dyse_mother

set scheme lean1
sort Country year
*scatter is used to add the starting and ending value labels*
twoway  (rarea lo_sex hi_sex year, lcolor(black%10))  ///
 (rarea lo_mom hi_mom year, lcolor(orange_red%10)) ///
 (line dydx_sex year, legend(row(1)) by(Country, note("")) clpattern(solid) clcolor(black)) ///
 (line dydx_mother year, legend(row(1)) by(Country,  note("")) clpattern(dash) clcolor(orange_red)) ///
  , ytitle("") legend(row(1)) xtitle("") xlabel (1999 2019) xsize(7) ysize(9) yline(0, lcolor(black%50)) ///
  legend(label(1 "") label(2 "")label(3 "Gender Gap") label(4 "Motherhood Penalty"))
  
graph save "Graph" "$MyProject\graphs\Fig1.gph", replace


*************************************************
*NOTE Table 1 made via LIS remote job submission*
*************************************************

use "$MyProject\data\HECK.dta", clear

************************************
*Table 2: Survey-level Descriptives*
************************************
*one way*
sum dydx_sex dydx_mother
*three-way*
sum dydx_sex_HP dydx_sex_LP dydx_sex_HC dydx_sex_LC dydx_par_WH dydx_par_WL dydx_par_MH	dydx_par_ML	 
*macro*
sum ecec1000 mospaid_lag1 mospaid_L6 mospaid_H6 gnorm_lag1 wpt_lag1 PubSec_lag1 year

**********************
*Appendix Figure 1: histograms*
**********************
set scheme lean1
cd "$MyProject\graphs"
hist dydx_sex, saving(sex) xline(0) xtitle(Gender Earnings Gap) 
hist dydx_mother, saving(mother) xline(0) xtitle(Motherhood Penalty) 
graph combine mother.gph sex.gph, xcommon ycommon rows(1) saving(Figure2)


******************
*Appendix Table 1 made via LIS remote job submission except for macro vars below*
******************
tabstat ecec1000, by(Country) s(min, max)
tabstat mospaid_lag1, by(Country) s(min, max)
tabstat gnorm_lag1 , by(Country) s(min, max)
tabstat wpt_lag1 , by(Country) s(min, max)
tabstat PubSec_lag1 , by(Country) s(min, max)

***************************************
*Online Appendix Table: Method Comparison
*TEST 4 methods on HECKMAN Full Sample*
*(1) cluster, (2) cluster hc2, dfadjust, (3) weight by inverse SE, (4) cluser wildbootstrap
***************************************
cd "$MyProject\tables"

estimates clear
qui reg dydx_sex c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, cluster(cname)
	eststo m_clus
qui reg dydx_sex c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_hc2
qui reg dydx_sex c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2 [aw=w_sex], cluster(cname)
	eststo m_aw
wildbootstrap regress dydx_sex c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, cluster(cname) rseed(12345)
eststo m_boot
	
esttab m* using Table_OS2_Method.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain replace

estimates clear
qui reg dydx_mother c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, cluster(cname)
	eststo m_clus
qui reg dydx_mother c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_hc2
qui reg dydx_mother c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2 [aw=w_mother], cluster(cname)
	eststo m_aw
wildbootstrap regress dydx_mother c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, cluster(cname) rseed(12345)
eststo m_boot
	
esttab m* using Table_OS2_Method.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append


*****************************************
*Table 3
*proceed with hc2 cluster, dfadjust
*loop by sample for sex gap and motherhood penalty
*****************************************

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_3.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain replace

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_mother c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_3.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

*caculate ICC to report in text*
estimates clear
local varlist dydx_sex dydx_mother 
foreach var of local varlist  {
    mixed `var'|| cname:
	estat icc
   }

*****************************************
*Table 4
*proceed with hc2 cluster, dfadjust
*loop by sample; repeat for eight outcomes*
*****************************************

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_HP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_4.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain replace

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_LP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_4.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_HC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_4.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_LC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_4.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_par_WH c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_4.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_par_WL c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_4.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_par_MH c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_4.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_par_ML c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_4.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

*use sureg to test equality of coefficents*
sureg (dydx_sex_HP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2) (dydx_sex_LP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2)(dydx_sex_HC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2)(dydx_sex_LC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2), vce(cluster cname)
test [dydx_sex_HP]c_mospaid_H6  = [dydx_sex_LP]c_mospaid_H6
* Prob > chi2 =    0.0031; tert parents>non-tert parents
test [dydx_sex_HP]c_mospaid_H6  = [dydx_sex_HC]c_mospaid_H6
*Prob > chi2 =    0.1565
test [dydx_sex_LP]c_mospaid_H6  = [dydx_sex_LC]c_mospaid_H6
*Prob > chi2 =    0.0558; MARG nontert parents>non-tert childless
test [dydx_sex_HC]c_mospaid_H6  = [dydx_sex_LC]c_mospaid_H6
*Prob > chi2 =    0.0083; tert childless>non-tert childless
test [dydx_sex_HC]c_mospaid_H6  = [dydx_sex_LP]c_mospaid_H6
*Prob > chi2 =    0.7084


****************************************
*Table 3a:
* REPEAT regression on 8 outcomes on REG.dta (not Heckman corrected) and each subsample
*Add to first column of Table 3
****************************************

cd "$MyProject\tables"

use "$MyProject\data\REG.dta", clear

*Table 2: Survey-level Descriptives
*one way*
sum dydx_sex dydx_mother
*three-way*
sum dydx_sex_HP dydx_sex_LP dydx_sex_HC dydx_sex_LC dydx_par_WH dydx_par_WL dydx_par_MH	dydx_par_ML	 

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_3.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_mother c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_3.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append


local varlist REG 
foreach var of local varlist  {
	use "$MyProject\data/`var'.dta", clear
estimates clear
qui reg dydx_sex_HP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_sex_HP
	esttab m* using Table_3a.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain replace
estimates clear  
qui reg dydx_sex_LP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_sex_LP
	esttab m* using Table_3a.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
estimates clear  
qui reg dydx_sex_HC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_sex_HC
	esttab m* using Table_3a.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
estimates clear  
qui reg dydx_sex_LC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_sex_LC
	esttab m* using Table_3a.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
estimates clear  
qui reg dydx_par_WH c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_par_WH
	esttab m* using Table_3a.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
estimates clear  
qui reg dydx_par_WL c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_par_WL
	esttab m* using Table_3a.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
estimates clear  
qui reg dydx_par_MH c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_par_MH
	esttab m* using Table_3a.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
estimates clear  
qui reg dydx_par_ML c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_par_ML
	esttab m* using Table_3a.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
estimates clear  
   }


**TABLE 4***   
   
cd "$MyProject\tables"
use "$MyProject\data\HECK.dta", clear 
   
*Table 4: Add variables to HECK Model for outcomes of interest*
local varlist HECK FT WH OCC PUB EXP FT_OCC 
foreach var of local varlist  {
	use "$MyProject\data/`var'.dta", clear
estimates clear
qui reg dydx_sex_HP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_sex_HP
qui reg dydx_sex_LP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_sex_LP
qui reg dydx_sex_HC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_sex_HC
qui reg dydx_sex_LC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_sex_LC
qui reg dydx_par_WH c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_par_WH
qui reg dydx_par_WL c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_par_WL
/*
qui reg dydx_par_MH c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_par_MH
qui reg dydx_par_ML c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_par_ML
*/
esttab m* using Table_4.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
   }

*for text in paper that accompanies T4*  
use "$MyProject\data/HECK.dta", clear  
*use sureg to test equality of coefficents*
sureg (dydx_sex_HP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2) (dydx_sex_LP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2)(dydx_sex_HC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2)(dydx_sex_LC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2), vce(cluster cname)
*test HP vs LP
test [dydx_sex_HP]c_mospaid_H6  = [dydx_sex_LP]c_mospaid_H6
* Prob > chi2 =    0.0031; tert parents>non-tert parents
*test HP vs HC
test [dydx_sex_HP]c_mospaid_H6  = [dydx_sex_HC]c_mospaid_H6
*Prob > chi2 =    0.1565
*test LP vs LC
test [dydx_sex_LP]c_mospaid_H6  = [dydx_sex_LC]c_mospaid_H6
*Prob > chi2 =    0.0558; MARG nontert parents>non-tert childless
*test HC vs LC
test [dydx_sex_HC]c_mospaid_H6  = [dydx_sex_LC]c_mospaid_H6
*Prob > chi2 =    0.0083; tert childless>non-tert childless
*test HC vs LP
test [dydx_sex_HC]c_mospaid_H6  = [dydx_sex_LP]c_mospaid_H6
*Prob > chi2 =    0.7084

*marginal effects and predicted values*
qui reg dydx_sex_HP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
margins, dydx(c_mospaid_H6)
margins, at(c_mospaid_H6=(-7.47 0 10.5 21 35.9))

qui reg dydx_sex_LP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
margins, dydx(c_mospaid_H6)
margins, at(c_mospaid_H6=(-7.47 0 10.5 21 35.9))  
   

*******************
*Figure 2 coeff plots*
*Keep estimate and confidence interval for c_mospaid_H6
*For 4 regressions: dydx_sex_HP dydx_sex_LP dydx_sex_HC dydx_sex_LC
*******************

*loop by sample; repeat for 4 groups*
cd "$MyProject\tables"
estimates clear
use "$MyProject\data\HECK.dta", clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_HP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }

etable, estimate(m*) keep(c_mospaid_H6) cstat(_r_b) cstat(_r_lb) cstat(_r_ub) column(estimates) export(Fig2_coefplot_data_HP.txt) replace   
   

local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_LP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }

etable, estimate(m*) keep(c_mospaid_H6) cstat(_r_b) cstat(_r_lb) cstat(_r_ub) column(estimates) export(Fig2_coefplot_data_LP.txt) replace 

local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_HC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }

etable, estimate(m*) keep(c_mospaid_H6) cstat(_r_b) cstat(_r_lb) cstat(_r_ub) column(estimates) export(Fig2_coefplot_data_HC.txt) replace 

local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_LC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }

etable, estimate(m*) keep(c_mospaid_H6) cstat(_r_b) cstat(_r_lb) cstat(_r_ub) column(estimates) export(Fig2_coefplot_data_LC.txt) replace 

****************************************
* REPEAT regression on 4 outcomes on on each subsample
****************************************

*appends above datasets after each model*
estimates clear
local varlist FT WH OCC PUB EXP FT_OCC
foreach var of local varlist  {
	use "$MyProject\data/`var'.dta", clear
estimates clear
qui reg dydx_sex_HP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_`var'_HP
	etable, estimate(m_`var'_HP) keep(c_mospaid_H6) cstat(_r_b) cstat(_r_lb) cstat(_r_ub) column(estimates) export(Fig2_coefplot_data_HP.txt, append) 
qui reg dydx_sex_LP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_`var'_LP
	etable, estimate(m_`var'_LP) keep(c_mospaid_H6) cstat(_r_b) cstat(_r_lb) cstat(_r_ub) column(estimates) export(Fig2_coefplot_data_LP.txt, append) 
qui reg dydx_sex_HC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_`var'_HC
	etable, estimate(m_`var'_HC) keep(c_mospaid_H6) cstat(_r_b) cstat(_r_lb) cstat(_r_ub) column(estimates) export(Fig2_coefplot_data_HC.txt, append) 
qui reg dydx_sex_LC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_`var'_LC
	etable, estimate(m_`var'_LC) keep(c_mospaid_H6) cstat(_r_b) cstat(_r_lb) cstat(_r_ub) column(estimates) export(Fig2_coefplot_data_LC.txt, append) 
   }
   
/*
*From .txt files:
coefplot_data_HP.txt
coefplot_data_LP.txt
coefplot_data_HC.txt
coefplot_data_LC.txt 

create 4 excel files of estimate (est), lower (ll95) and upper (ul95) ci for each model in graph:
$MyProject\excel_data\dydx_sex_HP_for_coeffplot.xlsx
$MyProject\excel_data\dydx_sex_LP_for_coeffplot.xlsx
$MyProject\excel_data\dydx_sex_HC_for_coeffplot.xlsx
$MyProject\excel_data\dydx_sex_LC_for_coeffplot.xlsx

File should look like (4 colums, 12 rows + labels)
First row of data "Full-Time" is from HECK.reg labeled "m_Sample_FT", second row "Full-Time+" is from "m_FT_.."
model		est		ll95	ul95
Full-Time	
Full-Time+	
Hours	
Hours+	
Occ	
Occ+	
Public	
Public+	
Exper	
Exper+	
FT-Occ	
FT-Occ+	

code below imports these excel files into Stata & makes plot
*/


*********
*Appendix Tables OS3-6: Re-run models for Figure 2 to create table for appendix: 12 models x 4 groups: 48 models*
*********

*base models 4 groups*
cd "$MyProject\tables"
estimates clear
use "$MyProject\data\HECK.dta", clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_HP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }

esttab m* using Table_OS3_baseHP.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain replace

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_LP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }

esttab m* using Table_OS4_baseLP.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain replace 

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_HC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }

esttab m* using Table_OS5_baseHC.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain replace

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_LC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }

esttab m* using Table_OS6_baseLC.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain replace

*append from models using additional controls*
estimates clear
local varlist FT WH OCC PUB EXP FT_OCC
foreach var of local varlist  {
	use "$MyProject\data/`var'.dta", clear
estimates clear
qui reg dydx_sex_HP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_`var'_HP
	esttab m* using Table_OS3_baseHP.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
}

estimates clear
local varlist FT WH OCC PUB EXP FT_OCC
foreach var of local varlist  {
	use "$MyProject\data/`var'.dta", clear
estimates clear
qui reg dydx_sex_LP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_`var'_LP
	esttab m* using Table_OS4_baseLP.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
}

estimates clear
local varlist FT WH OCC PUB EXP FT_OCC
foreach var of local varlist  {
	use "$MyProject\data/`var'.dta", clear
estimates clear
qui reg dydx_sex_HC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_`var'_HC
	esttab m* using Table_OS5_baseHC.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
}

estimates clear
local varlist FT WH OCC PUB EXP FT_OCC
foreach var of local varlist  {
	use "$MyProject\data/`var'.dta", clear
estimates clear
qui reg dydx_sex_LC c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_`var'_LC
	esttab m* using Table_OS6_baseLC.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
}

************
* Appendix Table 2: Mean Gender Earnings Gap, add var models       
************

*Base models*
estimates clear
use "$MyProject\data\HECK.dta", clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
    sum dydx_sex if `var'==1
   }

estimates clear
local varlist FT WH OCC PUB EXP FT_OCC
foreach var of local varlist  {
	use "$MyProject\data/`var'.dta", clear
estimates clear
sum dydx_sex
   }   
   
*********************
* SENSITIVITY ANALYSIS
**********************

******************
*Spline Length (OS Table A-1 Testing Leave Length)*
******************

use "$MyProject\data\FT.dta", clear

cd "$MyProject\tables"

mkspline mospaid_L3 3  mospaid_H3 =  mospaid_lag1
mkspline mospaid_L12 12  mospaid_H12 =  mospaid_lag1

local varlist mospaid_L3 mospaid_H3 mospaid_L12 mospaid_H12 
foreach var of local varlist  {
   egen m_`var' = mean(`var')
   gen  c_`var' = `var'-m_`var'
   drop m_`var'
   label variable c_`var' "Grand mean centered" 
   }

estimates clear
qui reg dydx_sex c_ecec1000 c_mospaid_lag1 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_lin
qui reg dydx_sex c_ecec1000 c.c_mospaid_lag1##c.c_mospaid_lag1 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_sq
qui reg dydx_sex c_ecec1000 c.c_mospaid_lag1##c.c_mospaid_lag1##c.c_mospaid_lag1 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_cub
qui reg dydx_sex c_ecec1000 c.c_mospaid_lag1##c.c_mospaid_lag1##c.c_mospaid_lag1##c.c_mospaid_lag1 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_4poly
mkspline2 ts= mospaid_lag1 , cubic nknots(4) displayknots
qui reg dydx_sex c_ecec1000 ts* c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_CS4
drop ts*
qui reg dydx_sex c_ecec1000 c_mospaid_L3 c_mospaid_H3 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_H3
qui reg dydx_sex c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_H6
qui reg dydx_sex c_ecec1000 c_mospaid_L9 c_mospaid_H9 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_H9
qui reg dydx_sex c_ecec1000 c_mospaid_L12 c_mospaid_H12 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_H12
mkspline mospaid1 8.99  mospaid2 21.99 mospaid3 =  mospaid_lag1
qui reg dydx_sex c_ecec1000 mospaid1 mospaid2 mospaid3 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_S3_9
drop mospaid1 mospaid2 mospaid3
mkspline mospaid1 6  mospaid2 21 mospaid3 =  mospaid_lag1
qui reg dydx_sex c_ecec1000 mospaid1 mospaid2 mospaid3 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_S3_6 

esttab m* using Table_OS1.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain replace

*************************
* RESTRICT ANALYSIS TO LAST OBSERVATION IN EACH COUNTRY, N =26: Tables OS-7 and OS-8*
*************************

use "$MyProject\data\HECK.dta", clear

cd "$MyProject\tables"

sort cname year
by cname : generate n1 = _n
by cname : generate n2 = _N
gen last=.
replace last=1 if n1==n2
tab year

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1 & last==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_OS7.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain replace

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_HP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1 & last==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_OS7.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_sex_LP c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1 & last==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_OS7.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_mother c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1 & last==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_OS8.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain replace

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_par_WH c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1 & last==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_OS8.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

estimates clear
local varlist Sample_all Sample_FT Sample_WH Sample_OCC Sample_Public Sample_EXP Sample_FT_OCC
foreach var of local varlist  {
   qui reg dydx_par_WL c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  if `var'==1 & last==1, vce(hc2 cname, dfadjust)
	eststo m_`var'
   }
   
esttab m* using Table_OS8.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

********************Sensitivity Analyses Not Shown****************************
*************
* Fathers' leave
*************
use "$MyProject\data\HECK.dta", clear

cd "$MyProject\tables"

estimates clear
qui reg dydx_sex c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2  c_mospaid_father_lag1, vce(hc2 cname, dfadjust)
eststo m_sex

qui reg dydx_mother c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2 c_mospaid_father_lag1, vce(hc2 cname, dfadjust)
eststo m_mom

esttab m*, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
esttab m* using STable_fathersleave.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append


************
* One country omitted
************
use "$MyProject\data\HECK.dta", clear

cd "$MyProject\tables"

estimates clear
global cos "at	au	be	ch	cz	de	dk	ee	es	fi	fr	gr	hu	ie	is	it	lt	lu	nl	no	pl	se	si	sk	uk	us" 
       
foreach cc in $cos {             
qui reg dydx_sex c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2 if cname!="`cc'", vce(hc2 cname, dfadjust) 
estimates store no_`cc'
   }
   
esttab n* using STable_omit_one.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

***********************
*Run NKIDS syntax in LIS, put resutls in Excel File named NKIDS_results.xlxs*
***********************

*Women only; nchildren*
local varlist NKIDS
foreach var of local varlist  {
	import excel "$MyProject\excel_data/`var'_results.xlsx", sheet("Sheet1") firstrow clear
	save "$MyProject\data/`var'.dta", replace
	merge 1:1 dname using "$MyProject\data\Macro_and_Sample_Vars.dta" 
	drop if _merge==2
	drop _merge
	order cname Country
	save "$MyProject\data/`var'.dta", replace
   }

cd "$MyProject\tables"   
estimates clear
reg dydx_mother c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_par
reg dydx_par_WH c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_par_WH
reg dydx_par_WL c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
	eststo m_par_WL
esttab m* using STable_Women_Nkids.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append

*********************	
*logged income as DV Run logged income syntax in LIS, resutls in Excel File*
*********************
/*Import LIS results from Excel
local varlist LOGGED_INC
foreach var of local varlist  {
	import excel "$MyProject\excel_data/`var'_results.xlsx", sheet("Sheet1") firstrow clear
	save "$MyProject\data/`var'.dta", replace
	merge 1:1 dname using "$MyProject\data\Macro_and_Sample_Vars.dta" 
	drop if _merge==2
	drop _merge
	order cname Country
	save "$MyProject\data/`var'.dta", replace
   }
*/
  
use "$MyProject\data\LOGGED_INC.dta", clear

cd "$MyProject\tables"

sum dydx_sex dydx_mother

estimates clear

reg dydx_sex c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_logsex
reg dydx_mother c_ecec1000 c_mospaid_L6 c_mospaid_H6 c_gnorm_lag1 c_wpt_lag1 c_PubSec_lag1 year2, vce(hc2 cname, dfadjust)
eststo m_logmom

esttab m* using STable_loginc.csv, se b(3) star bic aic r2 mtitles stardetach noparentheses nolines plain append
